/****************************************************************************
  Copyright (C) 2010 Wanderson Regis Silva
  All rights reserved
  Contact: Wanderson Regis Silva (wanderson.regis@ymail.com)

  This file is part of OpenEditor project

  This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
****************************************************************************/

#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <qhash.h>
#include <qmainwindow.h>

QT_BEGIN_NAMESPACE
class QAction;
class QActionGroup;
class QMdiArea;
class QMdiSubWindow;
class QMenu;
QT_END_NAMESPACE

class CodeEdit;
class FindDialog;

class MainWindow : public QMainWindow {
  FindDialog *__findDialog;
  int __countOpened;
  QAction *__close;
  QAction *__save;
  QAction *__saveAs;
  QAction *__revert;
  QAction *__undo;
  QAction *__redo;
  QAction *__cut;
  QAction *__copy;
  QAction *__paste;
  QAction *__selectAll;
  QAction *__findAndReplace;
  QActionGroup *__openedGrp;
  QHash<int, QMdiSubWindow*> __opened;
  QMdiArea *__mainArea;
  QMenu *__wndwMenu;

  Q_OBJECT
public:
  MainWindow(QWidget *parent = 0);
protected:
  void closeEvent(QCloseEvent *event);
private slots:
  void newAct(void);
  void openAct(void);
  void closeAct(void);
  void saveAct(void);
  void saveAsAct(void);
  void revertAct(void);

  void undoAct(void);
  void redoAct(void);
  void cutAct(void);
  void copyAct(void);
  void pasteAct(void);
  void selectAllAct(void);
  void findReplaceAct();
  void preferencesAct();

  void fullScreenAct(const bool &checked);

  void aboutAct(void);

  void editorActivated(QMdiSubWindow *editor);

  void selectionChanged(void);
  void showOpened(void);
  void textChanged(void);
};

#endif // MAINWINDOW_H
